<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function queryData(url){
        var p = new Promise(function(resolve,reject){
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function(){
                if(xhr.readyState != 4) return ;
                if(xhr.readyState == 4 && xhr.status == 200){
                    resolve(xhr.responseText);
                }else{
                    reject('服务器错误');
                }
            };
            xhr.open('get',url);
            xhr.send(null);
        })
        return p;
    }
</script>